package testcase.validationtest;

import junit.framework.TestCase;
import validation.*;
import card.Card;
import card.Cardset;

public class BombTest extends TestCase{
	private Type bomb;
	private Cardset cardset;

	@Override
	public void setUp(){
		cardset = new Cardset(2);
		bomb = Bomb.getInstance();
	}
	
	@Override
	public void tearDown(){
		bomb.clear();
		bomb = null;
	}
	
	// testcase
	public void testCorrBomb1(){
		cardset = new Cardset(4);
		cardset.clear();
		cardset.add(new Card('s','A'));
		cardset.add(new Card('h','A'));
		cardset.add(new Card('c','A'));
		cardset.add(new Card('d','A'));
		assertEquals(Bomb.getInstance().identify(cardset), bomb);
	}
	public void testCorrBomb2(){
		cardset = new Cardset(4);
		cardset.clear();
		cardset.add(new Card('s','3'));
		cardset.add(new Card('h','3'));
		cardset.add(new Card('c','3'));
		cardset.add(new Card('d','3'));
		assertEquals(Bomb.getInstance().identify(cardset), bomb);
	}
	public void testInCorrBomb1(){
		cardset = new Cardset(4);
		cardset.clear();
		cardset.add(new Card('s','A'));
		cardset.add(new Card('h','2'));
		cardset.add(new Card('c','A'));
		cardset.add(new Card('d','A'));
		assertEquals(Bomb.getInstance().identify(cardset),null);
	}
	public void testInCorrBomb2(){
		cardset = new Cardset(4);
		cardset.clear();
		cardset.add(new Card('s','A'));
		cardset.add(new Card('h','A'));
		cardset.add(new Card('c','A'));
		cardset.add(new Card('d','A'));
		cardset.add(new Card('d','2'));
		assertEquals(Bomb.getInstance().identify(cardset),null);
	}
	public void testPrior(){
		cardset = new Cardset(4);
		cardset.add(new Card('s','A'));
		cardset.add(new Card('h','A'));
		cardset.add(new Card('c','A'));
		cardset.add(new Card('d','A'));
		Cardset temp = new Cardset(4);
		temp.add(new Card('s','3'));
		temp.add(new Card('h','3'));
		temp.add(new Card('c','3'));
		temp.add(new Card('d','3'));
		bomb.lessPriorityThan(cardset);
		assertEquals(bomb.lessPriorityThan(temp), false);
	}
}
